package com.cmcc.aregister.ui.dialog;

import android.content.Context;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.cmcc.aregister.R;
import com.cmcc.aregister.cs.lazyimage.LazyImageView;
import com.cmcc.aregister.cs.model.Hospital;
import com.cmcc.aregister.cs.model.HospitalInfoModel;

public class HospitalInfoDialog extends MyDialog {
	private Button confirm;

	public HospitalInfoDialog(Context context, HospitalInfoModel hospitalInfoModel) {
		super(context);
		setContentView(R.layout.dialog_other_hospital_info);
//		((LazyImageView) findViewById(R.id.dialog_image)).loadImage(
//				hospital.image, 0, 0);
		((TextView) findViewById(R.id.dialog_title))
				.setText(hospitalInfoModel.hospitalname);
		((TextView) findViewById(R.id.dialog_phone))
				.setText(hospitalInfoModel.telephone);
		((TextView) findViewById(R.id.dialog_introduction))
				.setText(hospitalInfoModel.intro);
		((TextView) findViewById(R.id.dialog_traffic)).setText(hospitalInfoModel.ride);
//		((TextView) findViewById(R.id.dialog_traffic))
//				.setMovementMethod(ScrollingMovementMethod.getInstance());
		confirm = (Button) findViewById(R.id.dialog_confirm_btn);

		confirm.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				dismiss();
			}
		});
	}
	
	public HospitalInfoDialog(Context context, Hospital hospital) {
		super(context);
		setContentView(R.layout.dialog_hospital_info);
//		((LazyImageView) findViewById(R.id.dialog_image)).loadImage(
//				hospital.image, 0, 0);
		((TextView) findViewById(R.id.dialog_title))
				.setText(hospital.unit_name);
		((TextView) findViewById(R.id.dialog_grade))
				.setText(hospital.unit_level);
		((TextView) findViewById(R.id.dialog_address))
				.setText(hospital.address);
		((TextView) findViewById(R.id.dialog_phone)).setText(hospital.phone);
		((TextView) findViewById(R.id.dialog_traffic))
				.setText(hospital.bus_route);
		((TextView) findViewById(R.id.dialog_traffic))
				.setMovementMethod(ScrollingMovementMethod.getInstance());
		confirm = (Button) findViewById(R.id.dialog_confirm_btn);

		confirm.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				dismiss();
			}
		});
	}

	public void setCancelClickListener(View.OnClickListener onClickListener) {
		confirm.setOnClickListener(onClickListener);
	}
}
